<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h2>localStorage</h2>
<button onclick="saveData()">点我保存一个数据</button>
<script>
    function saveData() {
        localStorage.setItem('msg', 'hello!')
    }
</script>
</body>
</html>